import requests
from requests import request

r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print(r.status_code)
# print(r.headers['Server'])
# print(r.encoding)
# print(r.text)
# print(r.json())

r = requests.get(
    "https://qyapi.weixin.qq.com/cgi-bin/gettoken",
    {
        "corpid": "ww183fe17a0f308505",
        "corpsecret": "uldHoRf7KmFs-fNloZ8hB40fgXQR1B8FZwn9UM3gArk"
    }
)
json_object = r.json()
print(json_object["access_token"])

#
# r = requests.post(
#     "https://qyapi.weixin.qq.com/cgi-bin/user/create?access_token=YtVFVXZMmYyAFOeRC0c9yKRTP7IPFGmPlcEPoPmON4YoQgH7Feo5Db2S_ftsdkchKNb-S6aUgC4o-4QWDoeZXjdovsivnW1WF6cmSxjPIlrbKJDSG7hU72Jh7izweOPHGdlkQRhe_PX8AyVOJYm0T8AtF5ivWDihKg6n6d468o8sPwf5Uyu5VcnM2meOvsTQAR2N2V8RQmIdR47tedxCOg",
#     {
#         "userid": "zhangsan",
#         "name": "张三",
#         "alias": "jackzhang",
#         "mobile": "+86 13800000000",
#         "department": [1, 2],
#         "order": [10, 40],
#         "position": "产品经理",
#         "gender": "1",
#         "email": "zhangsan@gzdev.com",
#         "biz_mail": "zhangsan@qyycs2.wecom.work",
#         "is_leader_in_dept": [1, 0],
#         "direct_leader": ["lisi", "wangwu"],
#         "enable": 1,
#         "avatar_mediaid": "2-G6nrLmr5EC3MNb_-zL1dDdzkd0p7cNliYu9V5w7o8K0",
#         "telephone": "020-123456",
#         "address": "广州市海珠区新港中路",
#         "main_department": 1,
#         "extattr": {
#             "attrs": [
#                 {
#                     "type": 0,
#                     "name": "文本名称",
#                     "text": {
#                         "value": "文本"
#                     }
#                 },
#                 {
#                     "type": 1,
#                     "name": "网页名称",
#                     "web": {
#                         "url": "http://www.test.com",
#                         "title": "标题"
#                     }
#                 }
#             ]
#         },
#         "to_invite": True,
#         "external_position": "高级产品经理",
#         "external_profile": {
#             "external_corp_name": "企业简称",
#             "wechat_channels": {
#                 "nickname": "视频号名称"
#             },
#             "external_attr": [
#                 {
#                     "type": 0,
#                     "name": "文本名称",
#                     "text": {
#                         "value": "文本"
#                     }
#                 },
#                 {
#                     "type": 1,
#                     "name": "网页名称",
#                     "web": {
#                         "url": "http://www.test.com",
#                         "title": "标题"
#                     }
#                 },
#                 {
#                     "type": 2,
#                     "name": "测试app",
#                     "miniprogram": {
#                         "appid": "wx8bd8012614784fake",
#                         "pagepath": "/index",
#                         "title": "my miniprogram"
#                     }
#                 }
#             ]
#         }
#     }
# )
#
# print(r.json())
#
# # r = requests.delete()
# # r = requests.put()
#
# r_1 = request("get", )
#

